<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleChangeTab">
      <!-- <el-tab-pane label="内部订单" name="0" v-if="false"/> -->
      <el-tab-pane label="外部散户订单" name="1" />
      <el-tab-pane label="外部合作商订单" name="2" />
    </el-tabs>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="订单编号" prop="orderSn">
        <el-input v-model="queryParams.orderSn" placeholder="请输入订单编号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>

      <el-form-item label="土地类型" prop="landType">
        <el-select v-model="queryParams.orderState" placeholder="请选择土地类型" clearable>
          <el-option v-for="dict in landType" :key="dict.id" :label="dict.groundType" :value="dict.id" />
        </el-select>
      </el-form-item>

      <el-form-item label="作业类型" prop="workType">
        <el-select v-model="queryParams.orderState" placeholder="请选择作业类型" clearable>
          <el-option v-for="dict in dict.type.job_type" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
      <el-table-column type="index" label="序号" align="center" width="80" />

      <!-- <el-table-column type="selection" width="55" align="center" /> -->
      <!-- <el-table-column label="序号" align="center" prop="id" /> -->
      <el-table-column label="订单编号" align="center" prop="orderSn" width="180" />
      <el-table-column label="地址" align="center" prop="outerLocation" v-if="activeName == '1'" width="180" />

      <el-table-column label="土地类型" align="center" prop="landTypeName" width="180" />
      <el-table-column label="作业类型" align="center" prop="workTypeName" width="180" />

      <el-table-column label="机型要求" align="center" prop="orderJobItemSubJoint" width="180" />
      <el-table-column label="作业时间" align="center" width="180">
        <template slot-scope="scope">
          <span>
            {{ scope.row.workStartTime }} ~ {{ scope.row.workEndTime }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="预估总作业面积（亩）" align="center" prop="predictWorkArea" width="180" />
      <el-table-column label="预估单价（元/亩）" align="center" prop="predictUnitPrice" width="180" />
      <el-table-column label="预估总价（元）" align="center" prop="predictTotalPrice" width="180" />
      <el-table-column label="订单状态" align="center" prop="overdueStatus" width="180">
        <template slot-scope="scope">
          <span>
            待接单
          </span>
          <span v-if="scope.row.overdueStatus == 1" style="color: #ff6320;font-size: 14px;margin-left: 5px;">
            已超期
          </span>
        </template>

      </el-table-column>

      <el-table-column label="发布时间" align="center" prop="createTime" width="180" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180">
        <template slot-scope="scope">
          <el-button size="mini" type="text"  @click="handlePaiOrder(scope.row)"
          v-hasPermi="['order:info:edit']" v-if="scope.row.overdueStatus==1">派单</el-button>
          <el-button size="mini" type="text"  @click="handleUpdate(scope.row)"
            v-hasPermi="['order:info:edit']">驳回</el-button>
          <el-button size="mini" type="text"  @click="checkDetail(scope.row)"
            v-hasPermi="['order:info:remove']">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改需求订单对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="订单编号" prop="orderSn">
          <el-input v-model="form.orderSn" placeholder="请输入订单编号" />
        </el-form-item>
        <el-form-item label="订单类型" prop="orderType">
          <el-select v-model="form.orderType" placeholder="请选择订单类型">
            <el-option v-for="dict in dict.type.order_type" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="作业项目" prop="workItem">
          <el-input v-model="form.workItem" placeholder="请输入作业项目" />
        </el-form-item>
        <el-form-item label="机型，多选" prop="modelRequire">
          <el-input v-model="form.modelRequire" placeholder="请输入机型，多选" />
        </el-form-item>
        <el-form-item label="作业开始时间" prop="workStartTime">
          <el-date-picker clearable v-model="form.workStartTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择作业开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="作业结束时间" prop="workEndTime">
          <el-date-picker clearable v-model="form.workEndTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择作业结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="预估单价" prop="predictUnitPrice">
          <el-input v-model="form.predictUnitPrice" placeholder="请输入预估单价" />
        </el-form-item>
        <el-form-item label="预估总价" prop="predictTotalPrice">
          <el-input v-model="form.predictTotalPrice" placeholder="请输入预估总价" />
        </el-form-item>
        <el-form-item label="预估作业面积" prop="predictWorkArea">
          <el-input v-model="form.predictWorkArea" placeholder="请输入预估作业面积" />
        </el-form-item>
        <el-form-item label="创建人名称" prop="creatorName">
          <el-input v-model="form.creatorName" placeholder="请输入创建人名称" />
        </el-form-item>
        <el-form-item label="创建人唯一标识" prop="creatorId">
          <el-input v-model="form.creatorId" placeholder="请输入创建人唯一标识" />
        </el-form-item>
        <el-form-item label="需求发布时间" prop="addTime">
          <el-date-picker clearable v-model="form.addTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择需求发布时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="服务中心" prop="serviceCenter">
          <el-input v-model="form.serviceCenter" placeholder="请输入服务中心" />
        </el-form-item>
        <el-form-item label="订单主状态" prop="orderState">
          <el-select v-model="form.orderState" placeholder="请选择订单主状态">
            <el-option v-for="dict in dict.type.order_state" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="接单时间" prop="receiveTime">
          <el-date-picker clearable v-model="form.receiveTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择接单时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="接单人唯一标识" prop="receiverId">
          <el-input v-model="form.receiverId" placeholder="请输入接单人唯一标识" />
        </el-form-item>
        <el-form-item label="接单人" prop="receivePerson">
          <el-input v-model="form.receivePerson" placeholder="请输入接单人" />
        </el-form-item>
        <el-form-item label="接单人联系方式" prop="receivePersonContact">
          <el-input v-model="form.receivePersonContact" placeholder="请输入接单人联系方式" />
        </el-form-item>
        <el-form-item label="作业面积" prop="outVerifyWorkArea">
          <el-input v-model="form.outVerifyWorkArea" placeholder="请输入作业面积" />
        </el-form-item>
        <el-form-item label="单价" prop="outVerifyUnitPrice">
          <el-input v-model="form.outVerifyUnitPrice" placeholder="请输入单价" />
        </el-form-item>
        <el-form-item label="预估需确认总价" prop="outVerifyTotalPrice">
          <el-input v-model="form.outVerifyTotalPrice" placeholder="请输入预估需确认总价" />
        </el-form-item>
        <el-form-item label="已支付定金" prop="outVerifyDepositPaid">
          <el-input v-model="form.outVerifyDepositPaid" placeholder="请输入已支付定金" />
        </el-form-item>
        <el-form-item label="编辑订单信息提交确认的人的唯一标识" prop="submitConfirmPersonId">
          <el-input v-model="form.submitConfirmPersonId" placeholder="请输入编辑订单信息提交确认的人的唯一标识" />
        </el-form-item>
        <el-form-item label="编辑订单信息提交确认的人" prop="submitConfirmPerson">
          <el-input v-model="form.submitConfirmPerson" placeholder="请输入编辑订单信息提交确认的人" />
        </el-form-item>
        <el-form-item label="提交确认时间" prop="submitConfirmTime">
          <el-date-picker clearable v-model="form.submitConfirmTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择提交确认时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="确认时间" prop="confirmTime">
          <el-date-picker clearable v-model="form.confirmTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择确认时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="接单确认状态" prop="confirmStatus">
          <el-select v-model="form.confirmStatus" placeholder="请选择接单确认状态">
            <el-option v-for="dict in dict.type.confirm_status" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="实际单价" prop="realityUnitPrice">
          <el-input v-model="form.realityUnitPrice" placeholder="请输入实际单价" />
        </el-form-item>
        <el-form-item label="实际总价" prop="realityTotalPrice">
          <el-input v-model="form.realityTotalPrice" placeholder="请输入实际总价" />
        </el-form-item>
        <el-form-item label="实际作业面积" prop="realityWorkArea">
          <el-input v-model="form.realityWorkArea" placeholder="请输入实际作业面积" />
        </el-form-item>
        <el-form-item label="提交验收人唯一标识" prop="submitCheckPersonId">
          <el-input v-model="form.submitCheckPersonId" placeholder="请输入提交验收人唯一标识" />
        </el-form-item>
        <el-form-item label="提交验收人" prop="submitCheckPerson">
          <el-input v-model="form.submitCheckPerson" placeholder="请输入提交验收人" />
        </el-form-item>
        <el-form-item label="提交验收时间" prop="submitCheckTime">
          <el-date-picker clearable v-model="form.submitCheckTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择提交验收时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="验收状态" prop="checkState">
          <el-select v-model="form.checkState" placeholder="请选择验收状态">
            <el-option v-for="dict in dict.type.check_state" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="尾款金额" prop="balancePayment">
          <el-input v-model="form.balancePayment" placeholder="请输入尾款金额" />
        </el-form-item>
        <el-form-item label="验收人唯一标识" prop="checkPersonId">
          <el-input v-model="form.checkPersonId" placeholder="请输入验收人唯一标识" />
        </el-form-item>
        <el-form-item label="验收人" prop="checkPerson">
          <el-input v-model="form.checkPerson" placeholder="请输入验收人" />
        </el-form-item>
        <el-form-item label="验收时间" prop="checkTime">
          <el-date-picker clearable v-model="form.checkTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择验收时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="确认收款状态" prop="confirmReceiptStatus">
          <el-select v-model="form.confirmReceiptStatus" placeholder="请选择确认收款状态">
            <el-option v-for="dict in dict.type.confirm_receipt_status" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="确认收款人唯一标识" prop="confirmReceiptPersonId">
          <el-input v-model="form.confirmReceiptPersonId" placeholder="请输入确认收款人唯一标识" />
        </el-form-item>
        <el-form-item label="确认收款人" prop="confirmReceiptPerson">
          <el-input v-model="form.confirmReceiptPerson" placeholder="请输入确认收款人" />
        </el-form-item>
        <el-form-item label="确认收款时间" prop="confirmReceiptTime">
          <el-date-picker clearable v-model="form.confirmReceiptTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择确认收款时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="超期状态" prop="overdueStatus">
          <el-select v-model="form.overdueStatus" placeholder="请选择超期状态">
            <el-option v-for="dict in dict.type.overdue_status" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="订单驳回人唯一标识" prop="orderRefusePersonId">
          <el-input v-model="form.orderRefusePersonId" placeholder="请输入订单驳回人唯一标识" />
        </el-form-item>
        <el-form-item label="订单驳回人" prop="orderRefusePerson">
          <el-input v-model="form.orderRefusePerson" placeholder="请输入订单驳回人" />
        </el-form-item>
        <el-form-item label="订单驳回状态" prop="orderRefuseStatus">
          <el-select v-model="form.orderRefuseStatus" placeholder="请选择订单驳回状态">
            <el-option v-for="dict in dict.type.order_refuse_status" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="交易完成状态" prop="tradeCompleteStatus">
          <el-select v-model="form.tradeCompleteStatus" placeholder="请选择交易完成状态">
            <el-option v-for="dict in dict.type.trade_complete_status" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否是集团派单" prop="groupDispatchOrder">
          <el-input v-model="form.groupDispatchOrder" placeholder="请输入是否是集团派单" />
        </el-form-item>
        <el-form-item label="申请开票时间" prop="applyInvoicingTime">
          <el-date-picker clearable v-model="form.applyInvoicingTime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择申请开票时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="扩展字段1" prop="reVar1">
          <el-input v-model="form.reVar1" placeholder="请输入扩展字段1" />
        </el-form-item>
        <el-form-item label="扩展字段2" prop="reVar2">
          <el-input v-model="form.reVar2" placeholder="请输入扩展字段2" />
        </el-form-item>
        <el-form-item label="扩展字段3" prop="reVar3">
          <el-input v-model="form.reVar3" placeholder="请输入扩展字段3" />
        </el-form-item>
        <el-form-item label="扩展字段4" prop="reVar4">
          <el-input v-model="form.reVar4" placeholder="请输入扩展字段4" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="逻辑删除标记" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入逻辑删除标记" />
        </el-form-item>
        <el-form-item label="用户权限" prop="userId">
          <el-input v-model="form.userId" placeholder="请输入用户权限" />
        </el-form-item>
        <el-form-item label="部门权限" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入部门权限" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listInfo,
  getInfo,
  delInfo,
  addInfo,
  updateInfo,
  landTypeList,
} from "@/api/order/info";

export default {
  name: "Info",
  dicts: [
    "order_refuse_status",
    "order_state",
    "confirm_receipt_status",
    "check_state",
    "overdue_status",
    "trade_complete_status",
    "order_type",
    "confirm_status",
    "job_type",
  ],
  data() {
    return {
      // 选中tab
      activeName: 1,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 需求订单表格数据
      infoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderType: 1,
        orderSn: null,
        landType: null,
        workType: null,
        workItem: null,
        cropType: null,
        modelRequire: null,
        workStartTime: null,
        workEndTime: null,
        predictUnitPrice: null,
        predictTotalPrice: null,
        predictWorkArea: null,
        creatorName: null,
        creatorId: null,
        addTime: null,
        serviceCenter: null,
        orderState: null,
        receiveTime: null,
        receiverId: null,
        receivePerson: null,
        receivePersonContact: null,
        outVerifyWorkArea: null,
        outVerifyUnitPrice: null,
        outVerifyTotalPrice: null,
        outVerifyDepositPaid: null,
        submitConfirmPersonId: null,
        submitConfirmPerson: null,
        submitConfirmTime: null,
        confirmTime: null,
        confirmStatus: null,
        realityUnitPrice: null,
        realityTotalPrice: null,
        realityWorkArea: null,
        submitCheckPersonId: null,
        submitCheckPerson: null,
        submitCheckTime: null,
        checkState: null,
        balancePayment: null,
        checkPersonId: null,
        checkPerson: null,
        checkTime: null,
        confirmReceiptStatus: null,
        confirmReceiptPersonId: null,
        confirmReceiptPerson: null,
        confirmReceiptTime: null,
        overdueStatus: null,
        orderRefusePersonId: null,
        orderRefusePerson: null,
        orderRefuseStatus: null,
        tradeCompleteStatus: null,
        groupDispatchOrder: null,
        applyInvoicingTime: null,
        reVar1: null,
        reVar2: null,
        reVar3: null,
        reVar4: null,
        userId: null,
        deptId: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        orderSn: [
          { required: true, message: "订单编号不能为空", trigger: "blur" },
        ],
        orderType: [
          { required: true, message: "订单类型不能为空", trigger: "change" },
        ],
        landType: [
          { required: true, message: "土地类型不能为空", trigger: "change" },
        ],
        workType: [
          { required: true, message: "作业类型不能为空", trigger: "change" },
        ],
        workItem: [
          { required: true, message: "作业项目不能为空", trigger: "blur" },
        ],
        cropType: [
          { required: true, message: "作物类型不能为空", trigger: "change" },
        ],
        modelRequire: [
          { required: true, message: "机型，多选不能为空", trigger: "blur" },
        ],
        workStartTime: [
          { required: true, message: "作业开始时间不能为空", trigger: "blur" },
        ],
        workEndTime: [
          { required: true, message: "作业结束时间不能为空", trigger: "blur" },
        ],
        predictUnitPrice: [
          { required: true, message: "预估单价不能为空", trigger: "blur" },
        ],
        predictTotalPrice: [
          { required: true, message: "预估总价不能为空", trigger: "blur" },
        ],
        predictWorkArea: [
          { required: true, message: "预估作业面积不能为空", trigger: "blur" },
        ],
        creatorName: [
          { required: true, message: "创建人名称不能为空", trigger: "blur" },
        ],
        creatorId: [
          {
            required: true,
            message: "创建人唯一标识不能为空",
            trigger: "blur",
          },
        ],
        addTime: [
          { required: true, message: "需求发布时间不能为空", trigger: "blur" },
        ],
        serviceCenter: [
          { required: true, message: "服务中心不能为空", trigger: "blur" },
        ],
        orderState: [
          { required: true, message: "订单主状态不能为空", trigger: "change" },
        ],
        receiveTime: [
          { required: true, message: "接单时间不能为空", trigger: "blur" },
        ],
        receiverId: [
          {
            required: true,
            message: "接单人唯一标识不能为空",
            trigger: "blur",
          },
        ],
        receivePerson: [
          { required: true, message: "接单人不能为空", trigger: "blur" },
        ],
        receivePersonContact: [
          {
            required: true,
            message: "接单人联系方式不能为空",
            trigger: "blur",
          },
        ],
        outVerifyWorkArea: [
          { required: true, message: "作业面积不能为空", trigger: "blur" },
        ],
        outVerifyUnitPrice: [
          { required: true, message: "单价不能为空", trigger: "blur" },
        ],
        outVerifyTotalPrice: [
          {
            required: true,
            message: "预估需确认总价不能为空",
            trigger: "blur",
          },
        ],
        outVerifyDepositPaid: [
          { required: true, message: "已支付定金不能为空", trigger: "blur" },
        ],
        submitConfirmTime: [
          { required: true, message: "提交确认时间不能为空", trigger: "blur" },
        ],
        confirmTime: [
          { required: true, message: "确认时间不能为空", trigger: "blur" },
        ],
        confirmStatus: [
          {
            required: true,
            message: "接单确认状态不能为空",
            trigger: "change",
          },
        ],
        realityUnitPrice: [
          { required: true, message: "实际单价不能为空", trigger: "blur" },
        ],
        realityTotalPrice: [
          { required: true, message: "实际总价不能为空", trigger: "blur" },
        ],
        realityWorkArea: [
          { required: true, message: "实际作业面积不能为空", trigger: "blur" },
        ],
        submitCheckPersonId: [
          {
            required: true,
            message: "提交验收人唯一标识不能为空",
            trigger: "blur",
          },
        ],
        submitCheckPerson: [
          { required: true, message: "提交验收人不能为空", trigger: "blur" },
        ],
        submitCheckTime: [
          { required: true, message: "提交验收时间不能为空", trigger: "blur" },
        ],
        checkState: [
          { required: true, message: "验收状态不能为空", trigger: "change" },
        ],
        balancePayment: [
          { required: true, message: "尾款金额不能为空", trigger: "blur" },
        ],
        checkPersonId: [
          {
            required: true,
            message: "验收人唯一标识不能为空",
            trigger: "blur",
          },
        ],
        checkPerson: [
          { required: true, message: "验收人不能为空", trigger: "blur" },
        ],
        checkTime: [
          { required: true, message: "验收时间不能为空", trigger: "blur" },
        ],
        confirmReceiptStatus: [
          {
            required: true,
            message: "确认收款状态不能为空",
            trigger: "change",
          },
        ],
        confirmReceiptTime: [
          { required: true, message: "确认收款时间不能为空", trigger: "blur" },
        ],
        overdueStatus: [
          { required: true, message: "超期状态不能为空", trigger: "change" },
        ],
        orderRefuseStatus: [
          {
            required: true,
            message: "订单驳回状态不能为空",
            trigger: "change",
          },
        ],
        tradeCompleteStatus: [
          {
            required: true,
            message: "交易完成状态不能为空",
            trigger: "change",
          },
        ],
        groupDispatchOrder: [
          {
            required: true,
            message: "是否是集团派单不能为空",
            trigger: "blur",
          },
        ],
        applyInvoicingTime: [
          { required: true, message: "申请开票时间不能为空", trigger: "blur" },
        ],
      },
      landType: [],
    };
  },
  created() {
    this.getList();
    landTypeList().then((res) => {
      this.landType = res?.rows || [];
    });
  },
  methods: {
    //派单
    handlePaiOrder() {
      
    },
    /** 查询需求订单列表 */
    getList() {
      this.loading = true;
      listInfo(this.queryParams).then((response) => {
        this.infoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        orderSn: null,
        orderType: null,
        landType: null,
        workType: null,
        workItem: null,
        cropType: null,
        modelRequire: null,
        workStartTime: null,
        workEndTime: null,
        predictUnitPrice: null,
        predictTotalPrice: null,
        predictWorkArea: null,
        creatorName: null,
        creatorId: null,
        addTime: null,
        serviceCenter: null,
        orderState: null,
        receiveTime: null,
        receiverId: null,
        receivePerson: null,
        receivePersonContact: null,
        outVerifyWorkArea: null,
        outVerifyUnitPrice: null,
        outVerifyTotalPrice: null,
        outVerifyDepositPaid: null,
        submitConfirmPersonId: null,
        submitConfirmPerson: null,
        submitConfirmTime: null,
        confirmTime: null,
        confirmStatus: null,
        realityUnitPrice: null,
        realityTotalPrice: null,
        realityWorkArea: null,
        submitCheckPersonId: null,
        submitCheckPerson: null,
        submitCheckTime: null,
        checkState: null,
        balancePayment: null,
        checkPersonId: null,
        checkPerson: null,
        checkTime: null,
        confirmReceiptStatus: null,
        confirmReceiptPersonId: null,
        confirmReceiptPerson: null,
        confirmReceiptTime: null,
        overdueStatus: null,
        orderRefusePersonId: null,
        orderRefusePerson: null,
        orderRefuseStatus: null,
        tradeCompleteStatus: null,
        groupDispatchOrder: null,
        applyInvoicingTime: null,
        reVar1: null,
        reVar2: null,
        reVar3: null,
        reVar4: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        delFlag: null,
        userId: null,
        deptId: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },






    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加需求订单";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getInfo(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改需求订单";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateInfo(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addInfo(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 查看详情 */
    checkDetail(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除需求订单编号为"' + ids + '"的数据项？')
        .then(function () {
          return delInfo(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "order/info/export",
        {
          ...this.queryParams,
        },
        `info_${new Date().getTime()}.xlsx`
      );
    },
    handleChangeTab(tab) {
      this.queryParams.orderType = tab.name;
      this.handleQuery();
    },
  },
};
</script>
